<div class="question">
    <div class="control-group">
        <div class="controls">
            <textarea class="input-xxlarge" name="question" rows="3" 
                placeholder="Question" required>{{ question.question }}</textarea>
            <span class="help-block">
                The &lt;answer&gt; tag can be used to display the answer selection inline in the question text.
            </span>
        </div>
    </div>

    <div class="control-group">
        <div class="controls">
            <textarea class="input-xlarge" name="question-correct-info" rows="3" placeholder="Correct answer information">{% if question.correct_info %}{{ question.correct_info }}{% endif %}</textarea>
            <span class="help-inline">Information to the user when a correct answer is supplied to this question.</span>
        </div>
    </div>

    <div class="control-group">
        <div class="controls">
            <textarea class="input-xlarge" name="question-wrong-info" rows="3" placeholder="Wrong answer information">{% if question.wrong_info %}{{ question.wrong_info }}{% endif %}</textarea>
            <span class="help-inline">Information to the user when an incorrect answer is supplied to this question.</span>
        </div>
    </div>
        
    <legend>Settings</legend>    
    <div class="form-horizontal">       
        <div class="control-group">
            <label class="control-label" for="question-difficulty">Difficulty</label>
            <div class="controls">
                <select id="question-difficulty" name="question-difficulty">
                    <option value=""></option>
                    {% if question.difficulty == None %}
                        {% for difficulty in difficulties %}
                            <option value="{{ difficulty.id }}">
                                {{ difficulty }}
                            </option>
                        {% endfor %}
                    {% else %}
                        {% for difficulty in difficulties %}
                            {% if difficulty.id == question.difficulty %}
                                <option value="{{ difficulty.id }}" selected>
                                    {{ difficulty }}
                                </option>
                            {% else %}
                                <option value="{{ difficulty.id }}">
                                    {{ difficulty }}
                                </option>
                            {% endif %}
                        {% endfor %}
                    {% endif %}
                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="question-page">Page</label>
            <div class="controls">
                <select id="question-page" name="question-page">
                    <option value=""></option>
                    {% if question.page == None %}
                        {% for page  in pages %}
                            <option value="{{ page.id }}">
                                {{ page.title }}
                            </option>
                        {% endfor %}
                    {% else %}
                        {% for page in pages %}
                            {% if question.page.id == page.id %}
                                <option value="{{ page.id }}" selected>
                                    {{ page.title }}
                                </option>
                            {% else %}
                                <option value="{{ page.id }}">
                                    {{ page.title }}
                                </option>
                            {% endif %}
                        {% endfor %}
                    {% endif %}
                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="question-type">Question type</label>
            <div class="controls">
                <select id="question-type" name="question-type" required>
                    {% if question.question_type == None %}
                        {% for question_key, question_type  in question_types.items %}
                            {% if forloop.first %}
                                <option value="{{ question_key }}" selected>
                                    {{ question_type.name }}
                                </option>
                            {% else %}
                                <option value="{{ question_key }}">
                                    {{ question_type.name }}
                                </option>
                            {% endif %}
                        {% endfor %}
                    {% else %}
                        {% for question_key, question_type  in question_types.items %}
                            {% if question_key == question.question_type %}
                                <option value="{{ question_key }}" selected>
                                    {{ question_type.name }}
                                </option>
                            {% else %}
                                <option value="{{ question_key }}">
                                    {{ question_type.name }}
                                </option>
                            {% endif %}
                        {% endfor %}
                    {% endif %}
                </select>
            </div>
        </div>
        <div class="control-group">
            <div class="controls">
                <label class="checkbox">
                    <input id="question-english" name="question-english" type="checkbox" {% if question.english %}checked{% endif %}>
                        Question is entirely in English.
                    </input>
                </label>
            </div>
        </div>
        <div class="control-group">
            <div class="controls">
                <label class="checkbox">
                    <input id="question-case-sensitive" name="question-case-sensitive" type="checkbox" {% if question.is_case_sensitive %}checked{% endif %}>
                        Answer(s) are case sensitive
                    </input>
                </label>
            </div>
        </div>
    </div>
</div>


